package com.ruoyi.qms.service.impl;

import java.math.BigDecimal;
import java.util.List;
import com.ruoyi.common.core.utils.DateUtils;
import com.ruoyi.common.core.utils.SecurityUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.qms.mapper.QmsQcMapper;
import com.ruoyi.qms.domain.QmsQc;
import com.ruoyi.qms.service.IQmsQcService;

import javax.annotation.Resource;

/**
 * 质量检查Service业务层处理
 * 
 * @author ruoyi
 * @date 2021-11-04
 */
@Service
public class QmsQcServiceImpl implements IQmsQcService 
{
    @Resource
    private QmsQcMapper qmsQcMapper;

    /**
     * 查询质量检查
     * 
     * @param qcUuid 质量检查主键
     * @return 质量检查
     */
    @Override
    public QmsQc selectQmsQcByQcUuid(String qcUuid)
    {
        return qmsQcMapper.selectQmsQcByQcUuid(qcUuid);
    }

    /**
     * 查询质量检查列表
     * 
     * @param qmsQc 质量检查
     * @return 质量检查
     */
    @Override
    public List<QmsQc> selectQmsQcList(QmsQc qmsQc)
    {
        return qmsQcMapper.selectQmsQcList(qmsQc);
    }

    /**
     * 派工时实际可填写数量
     *
     * @param qmsQc 实际可派工数量
     * @return 派工数量
     */
    @Override
    public BigDecimal selectRemainQcQty(QmsQc qmsQc)
    {
        return qmsQcMapper.selectRemainQcQty(qmsQc);
    }
    /**
     * 新增质量检查
     * 
     * @param qmsQc 质量检查
     * @return 结果
     */
    @Override
    public int insertQmsQc(QmsQc qmsQc)
    {
        qmsQc.setCreateTime(DateUtils.getNowDate());
        qmsQc.setCreateBy(SecurityUtils.getUsername());
        return qmsQcMapper.insertQmsQc(qmsQc);
    }

    /**
     * 修改质量检查
     * 
     * @param qmsQc 质量检查
     * @return 结果
     */
    @Override
    public int updateQmsQc(QmsQc qmsQc)
    {
        qmsQc.setUpdateTime(DateUtils.getNowDate());
        qmsQc.setUpdateBy(SecurityUtils.getUsername());
        return qmsQcMapper.updateQmsQc(qmsQc);
    }

    /**
     * 批量删除质量检查
     * 
     * @param qcUuids 需要删除的质量检查主键
     * @return 结果
     */
    @Override
    public int deleteQmsQcByQcUuids(String[] qcUuids)
    {
        return qmsQcMapper.deleteQmsQcByQcUuids(qcUuids);
    }

    /**
     * 删除质量检查信息
     * 
     * @param qcUuid 质量检查主键
     * @return 结果
     */
    @Override
    public int deleteQmsQcByQcUuid(String qcUuid)
    {
        return qmsQcMapper.deleteQmsQcByQcUuid(qcUuid);
    }
}
